import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 班级专业关联信息 */
export interface ClassMajor {
          id: number; // 关联ID
          classId?: number; // 班级ID
          majorId?: number; // 专业ID
          majorDirectionId: number; // 专业方向ID
  }

// 班级专业关联 API
export const ClassMajorApi = {
  // 查询班级专业关联分页
  getClassMajorPage: async (params: any) => {
    return await request.get({ url: `/ao/class-major/page`, params })
  },

  // 查询班级专业关联详情
  getClassMajor: async (id: number) => {
    return await request.get({ url: `/ao/class-major/get?id=` + id })
  },

  // 新增班级专业关联
  createClassMajor: async (data: ClassMajor) => {
    return await request.post({ url: `/ao/class-major/create`, data })
  },

  // 修改班级专业关联
  updateClassMajor: async (data: ClassMajor) => {
    return await request.put({ url: `/ao/class-major/update`, data })
  },

  // 删除班级专业关联
  deleteClassMajor: async (id: number) => {
    return await request.delete({ url: `/ao/class-major/delete?id=` + id })
  },

  /** 批量删除班级专业关联 */
  deleteClassMajorList: async (ids: number[]) => {
    return await request.delete({ url: `/ao/class-major/delete-list?ids=${ids.join(',')}` })
  },

  // 导出班级专业关联 Excel
  exportClassMajor: async (params) => {
    return await request.download({ url: `/ao/class-major/export-excel`, params })
  },

  // 导入班级专业关联 Excel
  importClassMajor: async (data: FormData) => {
    return await request.upload({ url: `/ao/class-major/import`, data })
  },

  // 下载班级专业关联导入模板
  importTemplate: async () => {
    return await request.download({ url: `/ao/class-major/get-import-template` })
  },

  // 获取Excel工作表名称
  getExcelSheets: async (data: FormData) => {
    return await request.upload({ url: `/ao/class-major/get-excel-sheets`, data })
  },
}
